load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fboss_agent_push")

cpp_library(
    name = "nodebase",
    srcs = [
        "NodeBase.cpp",
    ],
    headers = [
        "DeltaFunctions.h",
        "DeltaFunctions-detail.h",
        "MapDelta.h",
        "NodeBase.h",
        "NodeBase-defs.h",
        "NodeMap.h",
        "NodeMap-defs.h",
        "NodeMapDelta.h",
        "NodeMapIterator.h",
    ],
    exported_deps = [
        "//fboss/agent:constants",
        "//fboss/agent:fboss-error",
        "//fboss/agent:fboss-types",
        "//folly/functional:apply_tuple",
        "//folly/json:dynamic",
    ],
    exported_external_deps = [
        "boost",
        "glog",
        ("boost", None, "boost_container"),
    ],
)

cpp_library(
    name = "state",
    srcs = [
        "AclEntry.cpp",
        "AclMap.cpp",
        "AclTable.cpp",
        "AclTableGroup.cpp",
        "AclTableGroupMap.cpp",
        "AclTableMap.cpp",
        "AggregatePort.cpp",
        "AggregatePortMap.cpp",
        "ArpEntry.cpp",
        "ArpResponseEntry.cpp",
        "ArpResponseTable.cpp",
        "ArpTable.cpp",
        "BufferPoolConfig.cpp",
        "BufferPoolConfigMap.cpp",
        "ControlPlane.cpp",
        "DsfNode.cpp",
        "DsfNodeMap.cpp",
        "FibInfo.cpp",
        "FibInfoMap.cpp",
        "FlowletSwitchingConfig.cpp",
        "ForwardingInformationBase.cpp",
        "ForwardingInformationBaseContainer.cpp",
        "ForwardingInformationBaseDelta.cpp",
        "ForwardingInformationBaseMap.cpp",
        "Interface.cpp",
        "InterfaceMap.cpp",
        "InterfaceMapDelta.cpp",
        "IpTunnel.cpp",
        "IpTunnelMap.cpp",
        "LabelForwardingInformationBase.cpp",
        "LoadBalancer.cpp",
        "LoadBalancerMap.cpp",
        "MacEntry.cpp",
        "MacTable.cpp",
        "MatchAction.cpp",
        "Mirror.cpp",
        "MirrorMap.cpp",
        "MirrorOnDropReport.cpp",
        "MirrorOnDropReportMap.cpp",
        "NdpEntry.cpp",
        "NdpResponseEntry.cpp",
        "NdpResponseTable.cpp",
        "NdpTable.cpp",
        "Port.cpp",
        "PortFlowletConfig.cpp",
        "PortFlowletConfigMap.cpp",
        "PortMap.cpp",
        "PortPgConfig.cpp",
        "PortQueue.cpp",
        "QcmConfig.cpp",
        "QosPolicy.cpp",
        "QosPolicyMap.cpp",
        "Route.cpp",
        "RouteNextHop.cpp",
        "RouteNextHopEntry.cpp",
        "RouteNextHopsMulti.cpp",
        "RouteTypes.cpp",
        "SflowCollector.cpp",
        "SflowCollectorMap.cpp",
        "StateDelta.cpp",
        "StateDelta-computeOperDelta.cpp",
        "StateUtils.cpp",
        "SwitchSettings.cpp",
        "SwitchState.cpp",
        "SystemPort.cpp",
        "SystemPortMap.cpp",
        "TeFlowEntry.cpp",
        "TeFlowTable.cpp",
        "Transceiver.cpp",
        "TransceiverMap.cpp",
        "UdfConfig.cpp",
        "UdfGroup.cpp",
        "UdfGroupMap.cpp",
        "UdfPacketMatcher.cpp",
        "UdfPacketMatcherMap.cpp",
        "Vlan.cpp",
        "VlanMap.cpp",
        "VlanMapDelta.cpp",
    ],
    headers = [
        "FibDeltaHelpers.h",
        "FibInfoDelta.h",
        "LabelForwardingEntry.h",
        "NeighborEntry.h",
        "NeighborEntry-defs.h",
        "NeighborResponseEntry.h",
        "NeighborResponseEntry-defs.h",
        "NeighborResponseTable.h",
        "NeighborTable.h",
        "NeighborTable-defs.h",
        "PortDescriptor.h",
        "Thrifty.h",
    ],
    propagated_pp_flags = ["-DENABLE_DYNAMIC_APIS"],
    exported_deps = [
        ":label_forwarding_action",
        ":nodebase",
        "//common/network/if:if-cpp2-types",
        "//fboss/agent:address_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:constants",
        "//fboss/agent:enum_utils",
        "//fboss/agent:fboss-error",
        "//fboss/agent:fboss-types",
        "//fboss/agent:fsdb_helper",
        "//fboss/agent:hwswitch_matcher",
        "//fboss/agent:lacp_types",
        "//fboss/agent:packet",
        "//fboss/agent:platform_config-cpp2-types",
        "//fboss/agent:switch_config-cpp2-reflection",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:switch_state-cpp2-reflection",
        "//fboss/agent:switch_state-cpp2-types",
        "//fboss/agent/if:common-cpp2-types",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//fboss/agent/if:mpls-cpp2-types",
        "//fboss/fsdb/common:utils",
        "//fboss/lib/phy:phy-cpp2-types",
        "//fboss/mka_service/if:mka_structs-cpp2-types",
        "//fboss/qsfp_service/if:transceiver-cpp2-types",
        "//fboss/thrift_cow/nodes:nodes",
        "//folly:conv",
        "//folly:fbstring",
        "//folly:memory",
        "//folly:network_address",
        "//folly:poly",
        "//folly:range",
        "//folly/debugging/symbolizer:symbolizer",
        "//folly/json:dynamic",
        "//folly/logging:logging",
        "//folly/poly:basic_interfaces",
        "//thrift/lib/cpp/util:enum_utils",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
    exported_external_deps = [
        "gflags",
        "glog",
        ("boost", None, "boost_container"),
    ],
)

cpp_library(
    name = "state_utils",
    srcs = [
        "StateUtils.cpp",
    ],
    headers = [
        "StateUtils.h",
    ],
    exported_deps = [
        ":state",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hwswitch_matcher",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "label_forwarding_action",
    srcs = [
        "LabelForwardingAction.cpp",
    ],
    headers = [
        "LabelForwardingAction.h",
    ],
    exported_deps = [
        "//fboss/agent:fboss-error",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//folly/hash:hash",
        "//folly/json:dynamic",
        "//thrift/lib/cpp/util:enum_utils",
    ],
)

cpp_library(
    name = "state_update",
    headers = [
        "StateUpdate.h",
        "StateUpdateHelpers.h",
    ],
    exported_deps = [
        "//folly:fbstring",
        "//folly:intrusive_list",
        "//folly:range",
        "//folly:string",
        "//folly/logging:logging",
    ],
)
